package com.wuliu.config;

import com.wuliu.interceptor.AppInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @author realue
 * @version 1.0
 * @date 2022-10-12 17:47
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    @Resource
    private AppInterceptor appInterceptor;

    //注册拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry)
    {
            registry.addInterceptor(appInterceptor).addPathPatterns("/**")
                    .excludePathPatterns("/swagger-ui/**","/swagger-resources/**","/v3/api-docs");
    }

}
